//
//  VedioPlayerViewController.m
//  CMVRFForIOS
//
//  Created by zhangnorman on 15/5/27.
//  Copyright (c) 2015年 hvacapp. All rights reserved.
//

#import "VedioPlayerViewController.h"
#import <GUIPlayerView.h>

@interface VedioPlayerViewController ()

@property (nonatomic,strong)GUIPlayerView *movie;

@end

@implementation VedioPlayerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    if (self.movie == nil) {
        self.movie = [[GUIPlayerView alloc]initWithFrame:[UIView frameWithOutNav]];
        [self.view addSubview:self.movie];
    }
    // Do any additional setup after loading the view.
}

-(void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:YES];
    self.title = self.titleStr;
    
    //视频文件路径
    NSString *path = [[NSBundle mainBundle] pathForResource:self.fileName ofType:@"mp4"];
    //视频URL
    NSURL *url = [NSURL fileURLWithPath:path];
    self.movie.videoURL = url;
    [self.movie prepareAndPlayAutomatically:YES];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:YES];
    [self.movie stop];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
